﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace game
{
    public class ThunderboltGun : Weapon
    {
        public ThunderboltGun(Scene scene, Ship shooter)
            : base(scene, shooter)
        {
            shotIntervalMs = 1000;
            loadSpeed = 0.001f;
            shotLoadCost = 1.0f;
        }

        public override bool Shoot(int layerIndex, Vector3 position, Vector3 rotation, Vector3 velocity)
        {
            if (!CanShoot())
            {
                return false;
            }

            Vector3 offset = 1500.0f * Vector3.Transform(
                    Vector3.Forward, Matrix.CreateRotationY(rotation.Y));

            position += offset;

            Projectile p = new Thunderbolt(scene, shooter, layerIndex, position, rotation);
            p.InitialVelocity = Vector3.Zero;
            scene.AddObject(p, layerIndex);

            timeFromShotMs = 0;

            scene.BilboardMgr.ThunderShot(position, Vector3.Zero, 1);

            return true;
        }

    }
}
